<template>
	<view class="">
		<view class="feedback_con">
			<view class="title flex justify  align">
				<text>请输入您的问题和意见</text>
				<text class="tip">0/200</text>
			</view>
			<textarea name="" v-model="con" id="" maxlength="200" cols="30" rows="10" placeholder="请您尽可能具体描述您遇到的问题，以便我们为您提供更及时有效的帮助"></textarea>
		</view>
		<view class="btn" @tap="onsubmit">
			提交
		</view>
	</view>
</template>

<script>
	const app = getApp()
	export default {
		data() {
			return {
				con:''
			}
		},
		onLoad() {
			
		},
		methods: {
			onsubmit(){
				if(this.con == ''){
					uni.showToast({
						title:'请输入您的问题和意见',
						icon:'none'
					})
					return 
				}
				uni.showLoading({
					title:'上传中'
				})
				uni.request({
					url: app.globalData.IP + 'addons/shopro/feedback/add',
					data: {content:this.con},
					header: {
						token: app.globalData.token
					},
					method: 'POST',
					success:function(res){
						uni.hideLoading()
						uni.showToast({
							title: '已提交反馈'
						})
						setTimeout(function(){
							uni.navigateBack({delta:1})
						},1000)
					},
					fail:function(err){
						uni.hideLoading()
						uni.showToast({
							title: '提交失败',
							icon:'none'
						})
					},
				})
			}
		}
	}
</script>

<style lang="scss">
	page{
		background: #F7F7F7;
	}
	
	.feedback_con{
		background-color: #fff;
		border-radius: 10rpx;
		padding: 20rpx;
		margin: 30rpx;
		color: #999;
		.title{
			font-size: 30rpx;
			color: #333;
			margin-bottom: 50rpx;
		}
		.tip{
			font-size: 26rpx;
		}
		textarea{
			width: 100%;
			color: #333;
		}
	}
	.btn{
		width: 580rpx;
		height: 80rpx;
		line-height: 80rpx;
		text-align: center;
		color: #fff;
		position: fixed;
		bottom: 80rpx;
		left: 50%;
		margin-left: -290rpx;
		background: var(--base);
		border-radius: 50rpx;
	}
</style>